import axios from "axios";

//设置超时
axios.defaults.timeout = 10000;
if (process.env.NODE_ENV === "development") {
    axios.defaults.baseURL = 'http://192.168.184.9:9000'  //开发环境-后端路径
 
}else {
axios.defaults.baseURL = 'https://admin.miraclegenesis.com/admin'  //开发环境-后端路径
 
}
//请求拦截器
axios.interceptors.request.use(
    config => {
      return config;
    },
    error => {
      return Promise.reject(error);
    }
  );
  //响应拦截器
  axios.interceptors.response.use(
    response => {
      if (response.status == 200) {
        return Promise.resolve(response);
      } else {
        return Promise.reject(response);
      }
    },
    error => {
    //   Dialog.alert({
    //     title: "提示",
    //     message: "网络请求失败，请刷新重试"
    //   });
    }
  )
  export default axios